<template>
  <div>
    <el-dialog
      v-dialogDrag
      append-to-body
      :close-on-click-modal="false"
      :before-close="crud.cancelCU"
      :visible="crud.status.cu > 0"
      :title="crud.status.title"
      width="500px"
    >
      <el-form
        ref="form"
        :model="form"
        :rules="rules"
        size="small"
        label-width="80px"
      >
        <el-form-item
          label="计划名称"
          prop="roomname"
        >
          <el-input
            v-model="form.roomname"
            style="width: 370px;"
            placeholder="输入教室名称"
          />
        </el-form-item>
        <el-form-item
          label="教学类型"
          prop="roomtype"
        >
          <el-select v-model="form.roomtype" placeholder="请选择教室类型">
            <el-option
              v-for="item in roomType"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        </el-form-item>
      </el-form>
      <div
        slot="footer"
        class="dialog-footer"
      >
        <el-button
          type="text"
          @click="crud.cancelCU"
        >
          取消
        </el-button>
        <el-button
          :loading="crud.status.cu === 2"
          type="primary"
          @click="crud.submitCU"
        >
          确认
        </el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { form } from '@crud/crud'
const defaultForm = {
  id: null
}
export default {
  mixins: [form(defaultForm)],
  props: {
    roomType: {
      type: Array,
      required: true
    }

  },
  data() {
    return {
      rules: {
        roomname: [
          { required: true, message: '请输入教室名称', trigger: 'blur' }
        ],
        teachtype: [
          { required: true, message: '请选择教室类型', trigger: 'blur' }
        ]
      }
    }
  },
  methods: {

  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  /deep/ .el-input-number .el-input__inner {
    text-align: left;
  }
</style>
